import { CoolController, BaseController } from '@cool-midway/core';
import { StudentInfoService } from '../../service/info';
import { StudentEntity } from '../../entity/student';
import { Inject, Get } from '@midwayjs/core';

@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: StudentEntity,
  service: StudentInfoService,
  pageQueryOp: {
    keyWordLikeFields: ['a.name'],
    fieldEq: ['a.status'],
    fieldLike: ['a.name'],
    select: ['a.*'],
  },
  listQueryOp: {
    keyWordLikeFields: ['a.name'],
    fieldEq: ['a.status'],
    fieldLike: ['a.name'],
    select: ['a.*'],
  },
})
export class AdminStudentController extends BaseController {
  @Inject()
  studentInfoService: StudentInfoService;

  @Get('/list')
  async list() {
    return this.studentInfoService.list();
  }
}
